/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package appGUI;

import java.awt.Color;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.Graphics;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JPanel;
import mainApp.Data;
import utils.DataAdapter;

/**
 *
 * @author Picto
 */
public class HighscoresPanel extends JPanel {

    InputStream fontLocation = this.getClass().getResourceAsStream("/appGUI/resources/DS-DIGI.TTF");
    Graphics g;
    Font font;
    Data data;
    DataAdapter da;

    public HighscoresPanel() {
        try {
            font = Font.createFont(Font.TRUETYPE_FONT, fontLocation);
        } catch (FontFormatException ex) {
            Logger.getLogger(HighscoresPanel.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(HighscoresPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        setBackground(Color.BLACK);
        da = new DataAdapter();
        data = new Data();
        data.setHighScores(da.getHighScores());
        g.setFont(font.deriveFont(50f));
        g.setColor(Color.GREEN);
        g.drawString("highscores", 190, 50);
        g.setFont(font.deriveFont(30f));
        g.drawString("First:..............................................." + data.getHighScores().get(0).getUser() + " | " + data.getHighScores().get(0).getScore() + "pts", 20, 170);
        g.drawString("Second:.........................................." + data.getHighScores().get(1).getUser() + " | " + data.getHighScores().get(1).getScore() + "pts", 20, 240);
        g.drawString("Third:..............................................." + data.getHighScores().get(2).getUser() + " | " + data.getHighScores().get(2).getScore() + "pts", 20, 310);
        g.drawString("Fourth:........................................." + data.getHighScores().get(3).getUser() + " | " + data.getHighScores().get(3).getScore() + "pts", 20, 380);
        g.drawString("Fifth:............................................." + data.getHighScores().get(4).getUser() + " | " + data.getHighScores().get(4).getScore() + "pts", 20, 450);
        g.drawString("Sixth:............................................." + data.getHighScores().get(5).getUser() + " | " + data.getHighScores().get(5).getScore() + "pts", 20, 520);
        g.drawString("Seventh:......................................." + data.getHighScores().get(6).getUser() + " | " + data.getHighScores().get(6).getScore() + "pts", 20, 590);
        g.drawString("Eighth:..........................................." + data.getHighScores().get(7).getUser() + " | " + data.getHighScores().get(7).getScore() + "pts", 20, 660);
        g.drawString("Nineth:..........................................." + data.getHighScores().get(8).getUser() + " | " + data.getHighScores().get(8).getScore() + "pts", 20, 730);
        g.drawString("Tenth:............................................." + data.getHighScores().get(9).getUser() + " | " + data.getHighScores().get(9).getScore() + "pts", 20, 800);
    }
}
